/*   /\_/\
*   (= ._.)
*   /  >  \>  Author: LJJ
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <iomanip>  // cout << fixed << setprecision(y) << x << endl;
#include <cmath>
#include <string>
#include <vector>
#define int long long
#define x first 
#define y second 
using namespace std;
const int N = 1e5 + 10;
int a[N];
typedef pair<int,int> PII;
PII p[N];
/* 二维vector数组
vector<vector<char>> g(n,vector<char>(n));
vector<vector<bool>> st(n,vector<bool>(m,false)); 
g.resize(n,vector<char>(m));
st.resize(n,vector<bool>(m,false));
*/
vector<vector<char>> g;
vector<vector<bool>> st;
using namespace std;
bool check(int x)
{
    if((x % 4 == 0 && x % 100) || (x % 400 == 0)) return true;
    return false;
}
void solve()
{
    int n;
    cin >> n;
    int ans = 30 + 31 + 30 + 31;
    for(int i = 2023; i <= n - 1; i++)
    {
        if(check(i))  ans += 366;
        else ans += 365;  
    }  

    if(check(n)) cout << (ans + 31 + 29 + 31 + 23) << endl;
    else cout << (ans + 31 + 28 + 31 + 23) << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- ) solve();
    return 0;
}

